# Maintainer: Orhun Parmaksız <orhun@archlinux.org>

pkgname=systeroid
pkgver=0.4.4
pkgrel=1
pkgdesc="A more powerful alternative to sysctl"
arch=('loong64' 'x86_64')
url="https://github.com/orhun/systeroid"
license=('MIT' 'Apache')
depends=('libxcb' 'libxkbcommon' 'linux-docs')
makedepends=('cargo' 'python')
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
sha512sums=('61d8f8bdd34404f57e237f0843f67c1aaf9d9e552fd7857bc770db1ebf6296ed6f1c86edcf620cde271ba86f9039ce39209908c2a0076bee8cf05aa2925351a3')

prepare() {
  cd "$pkgname-$pkgver"
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd "$pkgname-$pkgver"
  cargo build --release --frozen
}

check() {
  cd "$pkgname-$pkgver"
  NO_COLOR=1 cargo test --frozen --no-default-features
}

package() {
  cd "$pkgname-$pkgver"
  install -Dm 755 "target/release/$pkgname" -t "$pkgdir/usr/bin"
  install -Dm 755 "target/release/$pkgname-tui" -t "$pkgdir/usr/bin"
  install -Dm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname"
  install -Dm 644 LICENSE-MIT -t "$pkgdir/usr/share/licenses/$pkgname"
  install -Dm 644 "man8/$pkgname.8" -t "$pkgdir/usr/share/man/man8"
  install -Dm 644 "man8/$pkgname-tui.8" -t "$pkgdir/usr/share/man/man8"
}

# vim: ts=2 sw=2 et:
